<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>计数器</title>
<style>
body {
    counter-reset: section;
}
h2::before {
    counter-increment: section;
    content: "section" counter(section) ":";
}
</style>
</head>
<body>
    <h1>使用css计数器</h1>
    <h2>html教程</h2>
    <h2>javascript教程</h2>
    <h2>css教程</h2>
    <p><b>注意：</b>IE8需要指定！DOCTYPE 才可以支持该属性。</p>
</body>
</html>